(defun cont-fraction (a b &optional verbose)
  (if verbose
    (format *error-output* "a = ~a, b = ~a~%" (first a) (first b)))
  (+ (first b)
     (if (or (null (rest b)))
       0
       (/ (first a) (cont-fraction (rest a) (rest b) verbose)))))

; tests
(format *error-output* "~a (test) ~%" (cont-fraction '(2 4) '(1 3 5) t))
(format t "sqrt(2)~16t= ~,10g~%" (cont-fraction '(1 1 1 1 1 1 1 1) '(1 2 2 2 2 2 2 2 2)))
(format t "e~16t= ~,10g~%" (cont-fraction '(1 1 2 3 4 5 6 7) '(2 1 2 3 4 5 6 7 8)))
